<template>
	<view class="supplier">
		<image src="https://master.shengejiaju.cn/web/static/images/pic001@2x.png" mode="widthFix"></image>
		<view class="supplier-btn"><button type="primary" @click="FactoryAdd">意向成为供应商</button></view>
		<uni-popup type="center" ref="qrcodepop">
			<view class="qrcodepop"><image :src="QRcode" mode="widthFix" show-menu-by-longpress></image></view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				QRcode: ''
			};
		},
		methods: {
			FactoryAdd(){
				this.$api.FactoryAdd({type: 1}).then(res => {
					if(res.datas.url){
						this.QRcode = res.datas.url
						this.$nextTick(() => {
							this.$refs.qrcodepop.open()
						})
					}else{
						uni.showToast({
							icon: 'none',
							title: '申请成功，请等待客服人员与您联系!',
							duration: 1500
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.supplier{
		padding-top: 20rpx;
		padding-bottom: 130rpx;
		image{
			width: 100%;
		}
		.supplier-btn{
			position: fixed;
			bottom: 0;
			left: 0;
			right: 0;
			padding: 20rpx 30rpx;
			background-color: #FFF;
			border-top: solid 1px #EEE;
			button{
				border-radius: 50rpx;
				height: 90rpx;
				line-height: 90rpx;
				font-size: 30rpx;
			}
		}
		.qrcodepop{
			width: 600rpx;
			image{
				width: 100%;
				border-radius: 8rpx;
			}
		}
	}
</style>
